#pragma once

#include <string>
#include <deque>
//#include <vector>

using std::string;

class IRabbitMQUtil
{
public:
    virtual int Connect(const string &strHostname, int iPort, const string &strUser, const string &strPasswd) = 0;
    virtual int Disconnect() = 0;
    virtual int ExchangeDeclare(const string &strExchange, const string &strType) = 0;
    virtual int QueueDeclare(const string &strQueueName) = 0;
    virtual int QueueBind(const string &strQueueName, const string &strExchange, const string &strBindKey) = 0;
    virtual int QueueUnbind(const string &strQueueName, const string &strExchange, const string &strBindKey) = 0;
    virtual int QueueDelete(const string &strQueueName, int iIfUnused) = 0;
    //virtual int Publish(const string &strMessage, const string &strExchange, const string &strRoutekey) = 0;
    virtual int Publish(const string &strMessage, const string &strExchange, const string &strRoutekey, int ichannel = 2, bool need_reply = false) = 0;
    virtual int Consumer(const string strQueueName, std::deque<std::string> *message_queue, int GetNum = 1, struct timeval *timeout = NULL) = 0;
};

extern "C" _declspec(dllexport) IRabbitMQUtil* GetMQ(const string host, 
                                                     const int port, 
                                                     const string user, 
                                                     const string password, 
                                                     const string exchange, 
                                                     const string queue, 
                                                     const string bindKey,
                                                     std::deque<std::string> *message_queue);

extern "C" _declspec(dllexport) IRabbitMQUtil* GetMQClientOnly(const string host, 
                                                               const int port, 
                                                               const string user, 
                                                               const string password, 
                                                               const string exchange);